﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>应用信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
</head>
<body>
  <div class="layui-form layui-text" id="app_info" style="padding: 20px 20px 20px 20px;">
  </div>
  <script id="app_show" type="text/html">
      <table class="layui-table">
        <colgroup>
        <col width="140">
        <col>
        </colgroup>
        <tbody>
        <tr>
            <td>应用名称：</td>
            <td>
             {{#  if(d.name){ }}
             {{ d.name }}
             {{#  } }} 
            </td>
        </tr>
        <tr>
            <td>安装路径：</td>
            <td> {{ d.apppath }}</td>
        </tr>
        <tr>
            <td>应用标识：</td>
            <td> {{ d.appkey }}</td>
        </tr>
        <tr>
            <td>当前版本：</td>
            <td>
             V{{ d.version }}
            </td>
        </tr>
        <tr>
            <td>应用作者：</td>
            <td> {{ d.author }}</td>
        </tr>
        <tr>
            <td>安装时间：</td>
            <td> {{ d.datetime }}</td>
        </tr>
        <tr>
            <td>更新时间：</td>
            <td> {{ d.updatetime }}</td>
        </tr>
        <tr>
            <td>应用简介：</td>
            <td> {{ d.intro }}</td>
        </tr>
        <tr>
            <td>默认启动：</td>
            <td><a href="javascript:void();" data-type="{{d.id}}" class="layui-btn layui-btn-danger">设为默认首页APP</a></td>
        </tr>
        </tbody>
    </table>
  </script>
  <script src="/plugins/layui/layui.js"></script>
  <script>
  layui.config({
    base: '/plugins/layuiadmin/'
  }).extend({
    index: 'lib/index'
  }).use(['index','laytpl'], function(){
    var $ = layui.$, router = layui.router(),laytpl = layui.laytpl;
    layer.load();
    $.ajax({
        type: "get",
        url: "app_info",
        data: router.search,
        dataType: "json",
        success: function (res) {
            if (res.code == 0) {
                laytpl(app_show.innerHTML).render(res.data, function(html){
                    app_info.innerHTML = html;
                });
                layer.closeAll('loading'); 
            }
            else {
                layer.closeAll('loading'); 
                layer.alert(res.msg);
            }
        }
    });

    $('#app_info').on('click', '.layui-btn', function () {
        var id = $(this).data('type');
        layer.load();
        $.ajax({
            type: "post",
            url: "app_info",
            data: { id: id },
            dataType: "json",
            success: function (res) {
                layer.closeAll('loading'); 
                if (res.code == 0) {
                    layer.msg(res.msg,{time:1*1000});
                }
                else {
                    layer.alert(res.msg);
                }
            }
        });
    });

  })
  </script>
</body>
</html>